// 二分法查找 
int main()
{
	int arr[] = { 1,2,3,4,5,6,7,8,9,10 };
	scanf("%d", &k);
	int len = sizeof(arr) / sizeof(arr[0]);
	int left = 0, right = len - 1;
	int middle = 0;
	while (left <= right)
	{
		// middle  = (left + right) / 2;  // 存在数据溢出
        middle = left + (right - left ) / 2;
		if (arr[middle] < k)
			left = middle + 1;
		else if (arr[middle] > k)
			right = middle - 1;
		else
		{
			printf("找到了\n");
			printf("下标为%d\n", middle);
			break;
		}
	}
	if (left > right)
		printf("没有找到\n");
	return 0;
}